<!DOCTYPE html>
<html>
<body>
<input type="text" id="num" value="10">
<button onclick="factorial()">求阶乘</button>
<input type="text" id="result" value="3628800">
<script>
function factorial() {
    let n = parseInt(document.getElementById('num').value);
    let res = 1;
    for (let i = 1; i <= n; i++) {
        res *= i;
    }
    document.getElementById('result').value = res;
}
</script>
</body>
</html>